﻿using System.Net;

namespace Toybox.NicoSharp.Seiga
{
	using Extensions;
	using Utilities;

	public static class SeigaUtility
	{

		public static string GetImageUrl(string digits, CookieCollection cookies = null)
		{
			string url = NicoUrls.SeigaTop + "image/source?id=" + digits;
			return NicoWebClient.GetRedirectUrl(url, cookies.Coerce());
		}

		public static void DownloadImageFile(string digits, string fileName, CookieCollection cookies = null)
		{
			NicoWebClient client = new NicoWebClient();
			client.DownloadFile(GetImageUrl(digits, cookies), fileName);
		}

	}
}
